package com.lqq.designPattern.behavioral_pattern.iterator.jdk;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class after {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<Integer>();
        list.add(2);
        Iterator<Integer> iterator = list.iterator();
        while(iterator.hasNext()){
            Integer integer = iterator.next();
            if(integer==2)
                iterator.remove();   //注意这个地方
        }
    }
}
